package wbw.action;

import wbw.server.ServerAgentThread;
import wbw.thread.MainMapThread;
import msginfo.Msg.CMsg;
import msginfo.Msg.CMsgPos;

public class MainScenePathAction extends Action {
	private enum PathOpCode{
		Enter(1), Exit(2), Path(3);
		private final int value;
		PathOpCode(int value){
			this.value=value;
		}
		public int getValue(){
			return value;
		}
	}
	private float[] data = new float[5];
	public MainScenePathAction(ServerAgentThread sa,CMsg cmsg) throws Exception
	{
		System.out.println("pack...");
		if(cmsg.getMsgPosCount() > 0){
			CMsgPos cmp = cmsg.getMsgPos(0);
			data[0] = cmp.getId();
			data[1] = cmp.getOp();
			data[2] = cmp.getX();
			data[3] = cmp.getY();
			data[4] = cmp.getIsCross();
		}
		this.sa=sa;
	}
	
	
	@Override
	public float[] doAction() {
		
		if(data[0] == PathOpCode.Exit.value){
			MainMapThread.RolePosMap.remove((int)data[1]);
		}
		MainMapThread.mainLuaLauncher.pushAction(data);
		System.out.println();
		
		return null;
	}


}
